﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MediaPad"
	xmlns:implementation="clr-namespace:MediaPad.Implementation">
	
	<implementation:ObjectToStringConverter x:Key="ObjectToStringConverter" />

	<Style x:Key="MediaButtonStyle" TargetType="{x:Type Button}">
		<Setter Property="Margin"
				Value="0,1" />
		<Setter Property="HorizontalAlignment"
				Value="Center" />
		<Setter Property="VerticalAlignment"
				Value="Bottom" />
		<Setter Property="Border.BorderThickness"
				Value="1" />
		<Setter Property="Border.Background"
				Value="Black" />
		<Setter Property="TextBlock.FontSize"
				Value="14" />
		<Setter Property="Border.BorderBrush"
				Value="White" />
		<Setter Property="TextBlock.Foreground"
				Value="White" />
		<Setter Property="Visibility"
				Value="Collapsed" />
		<Setter Property="Width"
				Value="16" />
		<Setter Property="Height"
				Value="16" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ButtonBase}">
					<Border Name="xBorder"
							BorderBrush="{TemplateBinding Border.BorderBrush}"
							BorderThickness="{TemplateBinding Border.BorderThickness}"
							CornerRadius="{TemplateBinding Border.CornerRadius}"
							Background="{TemplateBinding Border.Background}"
							HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
							TextBlock.Foreground="{TemplateBinding Foreground}"
							Opacity="0.2">
						<TextBlock x:Name="xTxtBlock"
								   Text="{TemplateBinding Content}"
								   VerticalAlignment="Center"
								   HorizontalAlignment="Center"
								   TextWrapping="Wrap"
								   TextTrimming="CharacterEllipsis" />
					</Border>
					<ControlTemplate.Triggers>
						<EventTrigger RoutedEvent="Mouse.MouseEnter">
							<BeginStoryboard HandoffBehavior="SnapshotAndReplace">
								<Storyboard>
									<DoubleAnimation To="1"
                                     Storyboard.TargetName="xBorder" 
                                     Storyboard.TargetProperty="Opacity"
                                     Duration="0:0:.5"></DoubleAnimation>
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
						<EventTrigger RoutedEvent="Mouse.MouseLeave">
							<BeginStoryboard HandoffBehavior="SnapshotAndReplace">
								<Storyboard>
									<DoubleAnimation To="0.2"
                                     Storyboard.TargetName="xBorder" 
                                     Storyboard.TargetProperty="Opacity"
                                     Duration="0:0:.5"></DoubleAnimation>
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="MediaRoundButtonStyle" TargetType="{x:Type Button}">
		<Setter Property="HorizontalAlignment"
				Value="Center" />
		<Setter Property="Border.BorderThickness"
				Value="2" />
		<Setter Property="Border.Background"
				Value="Black" />
		<Setter Property="TextBlock.FontSize"
				Value="18" />
		<Setter Property="Border.BorderBrush"
				Value="White" />
		<Setter Property="TextBlock.Foreground"
				Value="White" />
		<Setter Property="Width"
				Value="24" />
		<Setter Property="Height"
				Value="24" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ButtonBase}">
					<Grid Name="xGrid"
						  TextBlock.Foreground="{TemplateBinding Foreground}"
						  Opacity="0.2">
						<Ellipse Name="xEllipse"
								 Stroke="{TemplateBinding Border.BorderBrush}"
								 StrokeThickness="{TemplateBinding Border.BorderThickness}"
								 Fill="{TemplateBinding Border.Background}"
								 HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
								 Width="{TemplateBinding Width}"
								 Height="{TemplateBinding Height}"
								 />

						<TextBlock x:Name="xTxtBlock"
								   Text="{TemplateBinding Content}"
								   VerticalAlignment="Center"
								   HorizontalAlignment="Center"
								   TextWrapping="Wrap"
								   TextTrimming="CharacterEllipsis" />
					</Grid>
					<ControlTemplate.Triggers>
						<EventTrigger RoutedEvent="Mouse.MouseEnter">
							<BeginStoryboard HandoffBehavior="SnapshotAndReplace">
								<Storyboard>
									<DoubleAnimation To="1"
                                     Storyboard.TargetName="xGrid" 
                                     Storyboard.TargetProperty="Opacity"
                                     Duration="0:0:.5"></DoubleAnimation>
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
						<EventTrigger RoutedEvent="Mouse.MouseLeave">
							<BeginStoryboard HandoffBehavior="SnapshotAndReplace">
								<Storyboard>
									<DoubleAnimation To="0.2"
                                     Storyboard.TargetName="xGrid" 
                                     Storyboard.TargetProperty="Opacity"
                                     Duration="0:0:.5"></DoubleAnimation>
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="BackgroundRadioButtonStyle" TargetType="{x:Type RadioButton}">
		<Setter Property="Margin" Value="5" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ButtonBase}">
					<Ellipse Name="xEllipse"
							 Stroke="Black"
							 StrokeThickness="3"
							 Fill="{TemplateBinding Border.Background}"
							 Width="25"
							 Height="25" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="ColorRadioButtonStyle" TargetType="{x:Type RadioButton}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<Ellipse Name="xEllipse"
							 Stroke="#404040"
							 StrokeThickness="2"
							 Fill="{TemplateBinding Border.Background}"
							 Width="20"
							 Height="20" />
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter TargetName="xEllipse" Property="Stroke" Value="White" />
						</Trigger> 
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="ColorRadioButtonStyle2" TargetType="{x:Type RadioButton}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<Ellipse Name="xEllipse"
							 Stroke="#404040"
							 StrokeThickness="2"
							 Fill="{TemplateBinding Border.Background}"
							 Width="25"
							 Height="25" />
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter TargetName="xEllipse" Property="Width" Value="35" />
							<Setter TargetName="xEllipse" Property="Height" Value="35" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="ToolButtonStyle" TargetType="{x:Type RadioButton}">
		<Setter Property="Margin" Value="5" />
		<Setter Property="Width" Value="50" />
		<Setter Property="Height" Value="50" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<Image Name="img" />
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter Property="BitmapEffect">
								<Setter.Value>
									<OuterGlowBitmapEffect GlowColor="RoyalBlue" GlowSize="8"  />
								</Setter.Value>
							</Setter>
						</Trigger>
						<Trigger Property="Tag" Value="Select">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/Select.png" />							
						</Trigger>
						<Trigger Property="Tag" Value="Ink">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/Draw.png" />
						</Trigger>
						<Trigger Property="Tag" Value="Text">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/Text.png" />
						</Trigger>
						<!--<Trigger Property="Tag" Value="Bullet">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/List.png" />
						</Trigger>-->
						<Trigger Property="Tag" Value="Media">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/Media.png" />
						</Trigger>
						<Trigger Property="Tag" Value="Erase">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/Erase.png" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="TooltipStyle" TargetType="{x:Type ToolTip}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ToolTip}">
					<Grid Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
						<Polygon Fill="#CFCFCF" Points="0,0 50,0 50,20 20,20 13,25 6,20 0,20" SnapsToDevicePixels="True" 
								 Stroke="#404040" StrokeThickness="3" />
						<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Top" TextBlock.FontWeight="Bold" />
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="ToolButtonLineThicknessStyle" TargetType="{x:Type RadioButton}">
		<Setter Property="Width" Value="60" />
		<Setter Property="Height" Value="24" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<Border Name="brd" BorderBrush="Transparent" BorderThickness="1" Background="#BFBFBF">
						<Image Name="img" />	
					</Border>					
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter TargetName="brd" Property="BorderBrush" Value="White"/>
						</Trigger>
						<Trigger Property="Tag" Value="Thick">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/ThickLine.png" />
						</Trigger>
						<Trigger Property="Tag" Value="Medium">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/MediumLine.png" />
						</Trigger>
						<Trigger Property="Tag" Value="Thin">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/ThinLine.png" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="ToolMediaStyle" TargetType="{x:Type RadioButton}">
		<Setter Property="Width" Value="25" />
		<Setter Property="Height" Value="25" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RadioButton}">
					<Border Name="brd">
						<Image Name="img" />
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter Property="Opacity" Value="0.5" />
							<Setter Property="BitmapEffect">
								<Setter.Value>
									<OuterGlowBitmapEffect GlowColor="RoyalBlue" GlowSize="8"  />
								</Setter.Value>
							</Setter>
						</Trigger>
						<Trigger Property="Tag" Value="Image">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/Picture.png" />
						</Trigger>
						<Trigger Property="Tag" Value="Video">
							<Setter TargetName="img" Property="Source" Value="/MediaPad;component/Resources/Images/Movie.png" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style x:Key="TextCheckBoxStyle" TargetType="{x:Type CheckBox}">
		<Setter Property="Width" Value="24" />
		<Setter Property="Height" Value="24" />
		<Setter Property="HorizontalContentAlignment" Value="Center" />
		<Setter Property="VerticalContentAlignment" Value="Center" />
		<Setter Property="Foreground" Value="White" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type CheckBox}">
					<Border Name="brd" BorderBrush="Black" BorderThickness="1" Background="#404040" CornerRadius="15">
						<ContentPresenter Content="{TemplateBinding Content}"
										  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
										  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsChecked" Value="True">
							<Setter TargetName="brd" Property="BorderBrush" Value="White"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="ComboBoxItemStyle" TargetType="{x:Type ComboBoxItem}">
		<Setter Property="Foreground" Value="Black" />
		<Setter Property="Background" Value="#404040" />
		<!--<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type ComboBoxItem}">
					<TextBlock Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" 
							   Text="{TemplateBinding Content}"/>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="Foreground" Value="White" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>-->
	</Style>
	
	<Style TargetType="{x:Type InkPresenter}">
		<Setter Property="TextBlock.Foreground" Value="Black" />
	</Style>

	<Style TargetType="{x:Type local:InkCanvasAdvUC}">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type local:InkCanvasAdvUC}">
					<Grid Name="xGrid">
						<Grid.RowDefinitions>
							<RowDefinition/>
							<RowDefinition Height="Auto"/>
						</Grid.RowDefinitions>

						<InkCanvas x:Name="xInkCanvas"
								   Background="{TemplateBinding Background}"
								   HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
								   Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
						</InkCanvas>

						<Grid x:Name="xToolPnl" Grid.Row="1" Height="70" Background="Gray" Opacity="0.1" >
							<Grid.Resources>
								<Style TargetType="{x:Type Image}">
									<Setter Property="HorizontalAlignment" Value="Center" />
									<Setter Property="VerticalAlignment" Value="Center" />
								</Style>
							</Grid.Resources>

							<Border HorizontalAlignment="Right" VerticalAlignment="Bottom">
								<StackPanel Orientation="Horizontal" Margin="10">
									<RadioButton x:Name="xBtnLightBg" Background="LightGray" Tag="LightGray" 
												 Style="{StaticResource BackgroundRadioButtonStyle}" />
									<RadioButton x:Name="xBtnKhakiBg" Background="DarkKhaki" Tag="DarkKhaki" 
												 Style="{StaticResource BackgroundRadioButtonStyle}" />
									<RadioButton x:Name="xBtnDimBg" Background="DimGray" Tag="DimGray" 
												 Style="{StaticResource BackgroundRadioButtonStyle}" />
								</StackPanel>
							</Border>
							
							<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
								<StackPanel x:Name="xInputs" Orientation="Horizontal">
									<Button x:Name="xBtnNew" Width="50" Height="50" Margin="5">
										<Button.Template>
											<ControlTemplate>
												<Border BorderBrush="DarkGray">
													<Image Source="/MediaPad;component/Resources/Images/New.png" />
												</Border>
											</ControlTemplate>
										</Button.Template>
										<Button.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												New
											</ToolTip>
										</Button.ToolTip>
									</Button>
									<Button x:Name="xBtnOpen" Width="50" Height="50" Margin="5">
										<Button.Template>
											<ControlTemplate>
												<Border BorderBrush="DarkGray">
													<Image Source="/MediaPad;component/Resources/Images/Open.png" />
												</Border>
											</ControlTemplate>
										</Button.Template>
										<Button.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												Open
											</ToolTip>
										</Button.ToolTip>
									</Button>
									<Button x:Name="xBtnSave" Width="50" Height="50" Margin="5,5,25,5">
										<Button.Template>
											<ControlTemplate>
												<Border BorderBrush="DarkGray">
													<Image Source="/MediaPad;component/Resources/Images/Save.png" />
												</Border>
											</ControlTemplate>
										</Button.Template>
										<Button.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												Save
											</ToolTip>
										</Button.ToolTip>
									</Button>
									<RadioButton x:Name="btnArrow" Style="{StaticResource ToolButtonStyle}" Tag="Select">
										<RadioButton.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												Select
											</ToolTip>
										</RadioButton.ToolTip>
									</RadioButton>
									<RadioButton x:Name="btnPen" Style="{StaticResource ToolButtonStyle}" Tag="Ink" >
										<RadioButton.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												Draw
											</ToolTip>
										</RadioButton.ToolTip>
									</RadioButton>
									<RadioButton x:Name="btnText" Style="{StaticResource ToolButtonStyle}" Tag="Text">
										<RadioButton.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												Text
											</ToolTip>
										</RadioButton.ToolTip>
									</RadioButton>
									<RadioButton x:Name="btnMedia" Style="{StaticResource ToolButtonStyle}" Tag="Media">
										<RadioButton.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												Media
											</ToolTip>
										</RadioButton.ToolTip>
									</RadioButton>
									<RadioButton x:Name="xBtnCut" Style="{StaticResource ToolButtonStyle}" Tag="Erase">
										<RadioButton.ToolTip>
											<ToolTip Style="{StaticResource TooltipStyle}" Height="35" Placement="Top">
												Erase
											</ToolTip>
										</RadioButton.ToolTip>
									</RadioButton>									
								</StackPanel>
							</StackPanel>

							<Popup Name="xInkSetup" AllowsTransparency="True" Placement="Top" PlacementTarget="{Binding ElementName=btnPen}">
								<Grid Height="110" Background="Transparent">
									<!--<Polygon Fill="#BFBFBF" Stroke="#404040" StrokeThickness="2" Points="0,0 140,0 140,90 40,90 30,100 20,90 0,90" />-->
									
									<Path Fill="#BFBFBF" Stroke="#404040" StrokeThickness="1">
										<Path.Data>
											<PathGeometry>
												<PathFigure StartPoint="20,0">
													<LineSegment Point="120,0" />
													<ArcSegment Point="140,20" Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="140,70" />
													<ArcSegment Point="120,90" Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="40,90" />
													<LineSegment Point="30,100" />
													<LineSegment Point="20,90" />
													<ArcSegment Point="0,70" Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="0,20" />
													<ArcSegment Point="20,0" Size="20,20" SweepDirection="Clockwise" />
												</PathFigure>
											</PathGeometry>
										</Path.Data>
									</Path>
									
									<Grid>
										<Grid.ColumnDefinitions>
											<ColumnDefinition />
											<ColumnDefinition />
										</Grid.ColumnDefinitions>

										<StackPanel Orientation="Vertical" Margin="10,10,5,10" VerticalAlignment="Top">
											<RadioButton x:Name="xBtnThickLine" Style="{StaticResource ToolButtonLineThicknessStyle}" Tag="Thick" />
											<RadioButton x:Name="xBtnMediumLine" Style="{StaticResource ToolButtonLineThicknessStyle}" Tag="Medium" />
											<RadioButton x:Name="xBtnThinLine" Style="{StaticResource ToolButtonLineThicknessStyle}" Tag="Thin" />
										</StackPanel>

										<Grid Grid.Column="1" Margin="5,10,10,10" VerticalAlignment="Top">
											<Grid.ColumnDefinitions>
												<ColumnDefinition/>
												<ColumnDefinition/>
											</Grid.ColumnDefinitions>
											<Grid.RowDefinitions>
												<RowDefinition/>
												<RowDefinition/>
												<RowDefinition/>
											</Grid.RowDefinitions>

											<RadioButton x:Name="xBtnLineBlack" Style="{StaticResource ColorRadioButtonStyle}" Background="Black"
														 Grid.Column="0" Grid.Row="0"/>
											<RadioButton x:Name="xBtnLineYellow" Style="{StaticResource ColorRadioButtonStyle}" Background="Yellow"
														 Grid.Column="1" Grid.Row="0"/>
											<RadioButton x:Name="xBtnLineGreen" Style="{StaticResource ColorRadioButtonStyle}" Background="Green"
														 Grid.Column="0" Grid.Row="1" Margin="0,5" />
											<RadioButton x:Name="xBtnLineBrick" Style="{StaticResource ColorRadioButtonStyle}" Background="#FFC000"
														 Grid.Column="1" Grid.Row="1" Margin="0,5" />
											<RadioButton x:Name="xBtnLineBlue" Style="{StaticResource ColorRadioButtonStyle}" Background="#4F81BD"
														 Grid.Column="0" Grid.Row="2"/>
											<RadioButton x:Name="xBtnLineRed" Style="{StaticResource ColorRadioButtonStyle}" Background="Red"
														 Grid.Column="1" Grid.Row="2"/>
										</Grid>
									</Grid>
								</Grid>								
							</Popup>

							<Popup Name="xTextSetup" AllowsTransparency="True" Placement="Top" PlacementTarget="{Binding ElementName=btnText}">
								<Grid Height="115" Background="Transparent">
									<!--<Polygon Fill="#BFBFBF" Stroke="#404040" StrokeThickness="2" Points="0,0 330,0 330,95 40,95 30,105 20,95 0,95" />-->
									
									<Path Fill="#BFBFBF" Stroke="#404040" StrokeThickness="1">
										<Path.Data>
											<PathGeometry>
												<PathFigure StartPoint="20,0">
													<LineSegment Point="310,0" />
													<ArcSegment Point="330,20"  Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="330,75" />
													<ArcSegment Point="310,95"  Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="40,95" />
													<LineSegment Point="30,105" />
													<LineSegment Point="20,95" />
													<ArcSegment Point="0,75"  Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="0,20" />
													<ArcSegment Point="20, 0"  Size="20,20" SweepDirection="Clockwise" />
												</PathFigure>
											</PathGeometry>
										</Path.Data>										
									</Path>

									<Grid Margin="5,0,5,5">
										<Grid.RowDefinitions>
											<RowDefinition />
											<RowDefinition />
										</Grid.RowDefinitions>
										
										<Grid>
											<Grid.ColumnDefinitions>
												<ColumnDefinition/>
												<ColumnDefinition/>
												<ColumnDefinition/>
												<ColumnDefinition/>
												<ColumnDefinition/>
												<ColumnDefinition/>
											</Grid.ColumnDefinitions>
											
											<RadioButton x:Name="xBtnTextBlack" Grid.Column="0" Style="{StaticResource ColorRadioButtonStyle2}" Margin="10" Background="Black" />
											<RadioButton x:Name="xBtnTextWhite" Grid.Column="1" Style="{StaticResource ColorRadioButtonStyle2}" Margin="10" Background="White" />
											<RadioButton x:Name="xBtnTextBlue" Grid.Column="2" Style="{StaticResource ColorRadioButtonStyle2}" Margin="10" Background="Blue" />
											<RadioButton x:Name="xBtnTextYellow" Grid.Column="3" Style="{StaticResource ColorRadioButtonStyle2}" Margin="10" Background="Yellow" />
											<RadioButton x:Name="xBtnTextGreen" Grid.Column="4" Style="{StaticResource ColorRadioButtonStyle2}" Margin="10" Background="Green" />
											<RadioButton x:Name="xBtnTextRed" Grid.Column="5" Style="{StaticResource ColorRadioButtonStyle2}" Margin="10" Background="Red" />
										</Grid>

										<Grid Margin="5,0" Grid.Row="1"
											  TextBlock.FontSize="12" TextBlock.FontStyle="Normal"
											  TextBlock.Foreground="Black" TextBlock.FontFamily="Arial" TextBlock.FontWeight="Normal" 
												VerticalAlignment="Top">
											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="Auto"/>
												<ColumnDefinition />
												<ColumnDefinition />
												<ColumnDefinition />
												<ColumnDefinition />
												<ColumnDefinition />
											</Grid.ColumnDefinitions>
											<ComboBox x:Name="xFontFamiliesCombo" Grid.Column="0" Margin="5,0"
													  Background="#404040" BorderBrush="Black" BorderThickness="1" Foreground="Black"
													  ItemsSource="{x:Static Fonts.SystemFontFamilies}" Height="20"
													  Width="145" FontSize="12" ItemContainerStyle="{StaticResource ComboBoxItemStyle}" />
											<Button Name="xBtnFontSizeUp" Grid.Column="1" Margin="2,0">
												<Button.Template>
													<ControlTemplate>
														<Border Background="#404040" Width="24" Height="24" CornerRadius="12">
															<TextBlock Text="p" FontFamily="Wingdings 3" Foreground="White" 
																	   VerticalAlignment="Center" HorizontalAlignment="Center" />
														</Border>
													</ControlTemplate>
												</Button.Template>
											</Button>
											<Button Name="xBtnFontSizeDown" Grid.Column="2" Margin="2,0">
												<Button.Template>
													<ControlTemplate>
														<Border Background="#404040" Width="24" Height="24" CornerRadius="12">
															<TextBlock Text="q" FontFamily="Wingdings 3" Foreground="White"
																	   VerticalAlignment="Center" HorizontalAlignment="Center" />
														</Border>
													</ControlTemplate>
												</Button.Template>
											</Button>
											<CheckBox x:Name="btnBold" Grid.Column="3" Style="{StaticResource TextCheckBoxStyle}" Margin="5,0,2,0" TextBlock.FontWeight="Bold">
												B
											</CheckBox>
											<CheckBox x:Name="btnItalic" Grid.Column="4" Style="{StaticResource TextCheckBoxStyle}" Margin="2,0" TextBlock.FontStyle="Italic">
												i
											</CheckBox>
											<CheckBox x:Name="btnBullet" Grid.Column="5" Style="{StaticResource TextCheckBoxStyle}" Margin="2,0">
												<Image Source="/MediaPad;component/Resources/Images/List.png" />
											</CheckBox>
										</Grid>
									</Grid>
								</Grid>
							</Popup>

							<Popup Name="xMediaSetup" AllowsTransparency="True" Placement="Top" PlacementTarget="{Binding ElementName=btnMedia}">
								<Grid Height="65" Background="Transparent">
									<!--<Polygon Fill="#BFBFBF" Stroke="#404040" StrokeThickness="2" Points="0,0 80,0 80,45 30,45 20,55 10,45 0,45" />-->

									<Path Fill="#BFBFBF" Stroke="#404040" StrokeThickness="1">
										<Path.Data>
											<PathGeometry>
												<PathFigure StartPoint="20,0">
													<LineSegment Point="60,0" />
													<ArcSegment Point="80,20" Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="80,25" />
													<ArcSegment Point="60,45" Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="40,45" />
													<LineSegment Point="30,55" />
													<LineSegment Point="20,45" />
													<ArcSegment Point="0,25" Size="20,20" SweepDirection="Clockwise" />
													<LineSegment Point="0,20" />
													<ArcSegment Point="20,0" Size="20,20" SweepDirection="Clockwise" />
												</PathFigure>
											</PathGeometry>
										</Path.Data>
									</Path>

									<Grid>
										<Grid.ColumnDefinitions>
											<ColumnDefinition/>
											<ColumnDefinition/>
										</Grid.ColumnDefinitions>

										<RadioButton x:Name="xBtnImage" VerticalAlignment="Top" Grid.Column="0" Margin="10,10,5,10" Style="{StaticResource ToolMediaStyle}" Tag="Image" />
										<RadioButton x:Name="xBtnVideo" VerticalAlignment="Top" Grid.Column="1" Margin="5,10,10,10" Style="{StaticResource ToolMediaStyle}" Tag="Video" />
									</Grid>
								</Grid>
							</Popup>
						</Grid>
					</Grid>
					<ControlTemplate.Triggers>
						<EventTrigger SourceName="xToolPnl" RoutedEvent="Mouse.MouseEnter">
							<BeginStoryboard HandoffBehavior="SnapshotAndReplace">
								<Storyboard>
									<DoubleAnimation To="0.6"
                                     Storyboard.TargetName="xToolPnl" 
                                     Storyboard.TargetProperty="Opacity"
                                     Duration="0:0:.5"></DoubleAnimation>
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
						<EventTrigger SourceName="xToolPnl" RoutedEvent="Mouse.MouseLeave">
							<BeginStoryboard HandoffBehavior="SnapshotAndReplace">
								<Storyboard>
									<DoubleAnimation To="0.1"
                                     Storyboard.TargetName="xToolPnl" 
                                     Storyboard.TargetProperty="Opacity"
                                     Duration="0:0:.5"></DoubleAnimation>
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
						<Trigger SourceName="btnPen" Property="IsFocused" Value="True">
							<Setter TargetName="xInkSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="xInkSetup" Property="IsKeyboardFocusWithin" Value="True">
							<Setter TargetName="xInkSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="xInkSetup" Property="IsMouseOver" Value="True">
							<Setter TargetName="xInkSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="btnText" Property="IsFocused" Value="True">
							<Setter TargetName="xTextSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="xTextSetup" Property="IsKeyboardFocusWithin" Value="True">
							<Setter TargetName="xTextSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="xTextSetup" Property="IsMouseOver" Value="True">
							<Setter TargetName="xTextSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="btnMedia" Property="IsFocused" Value="True">
							<Setter TargetName="xMediaSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="xMediaSetup" Property="IsKeyboardFocusWithin" Value="True">
							<Setter TargetName="xMediaSetup" Property="IsOpen" Value="True" />
						</Trigger>
						<Trigger SourceName="xMediaSetup" Property="IsMouseOver" Value="True">
							<Setter TargetName="xMediaSetup" Property="IsOpen" Value="True" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>
